package com.bootdo_jpa.system.service.impl;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Service;

import com.bootdo_jpa.system.dao.PhotoRepository;
import com.bootdo_jpa.system.domain.PhotoDO;
import com.bootdo_jpa.system.service.PhotoService;
import com.bootdo_jpa.common.service.base.AbsCommonService;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
public class PhotoServiceImpl extends AbsCommonService<PhotoDO> implements PhotoService {
	
	@Autowired
	private PhotoRepository photoRepository;

	@Override
	public PhotoDO upload(PhotoDO photoDO) {
		return save(photoDO);
	}
	
	@Override
	@Transactional
	public void deleteByIds(Long... ids) {
		photoRepository.deleteByIdIn(ids);
	}

	@Override
	public JpaRepository<PhotoDO, Long> getDao() {
		return photoRepository;
	}

	@Override
	public JpaSpecificationExecutor<PhotoDO> getDao2() {
		return photoRepository;
	}
	
}
